//
//  MonsterTroop.hpp
//  fingeradvanture
//
//  Created by shuaibincheng on 16/5/7.
//
//

#ifndef MonsterTroop_hpp
#define MonsterTroop_hpp

#include "cocos2d.h"
#include "TroopForm.hpp"

USING_NS_CC;

class MonsterTroopFactory
{
public:
    static const int TROOP_MAX_MONSTERS;    //怪物组中怪物的最大个数
public:
    Vector<Node *> spawn(b2World *world);       //生成一组怪物
    
    static MonsterTroopFactory *getInstance();
    
private:
    int randomNumberOfMonsters();
    TroopFormType chooseTroopFormByNumOfMonster(int num);
    std::vector<TroopFormType> availableTroopFormsByNumOfMonster(int num);
    TroopFormType randomTroopFormFromAvailableForms(const std::vector<TroopFormType> &forms);
    int randomNumOfMonsterTypeForTroopFrom(const TroopForm *form);
    std::vector<MonsterType> randomMonsterTypes(const std::vector<MonsterType> &availables, int num);
    TroopActionStyle randomTroopActionTypeForTroopByForm(TroopForm *form);
    void randomActionForMonsterByForm(Node *monster, TroopForm *form);
    void randomActionForTroopByForm(Node *troop, TroopForm *form);
    TroopStyleType randomTroopStyleTypeForTroopByForm(TroopForm *form);
private:
    static MonsterTroopFactory *factory;
};

#endif /* MonsterTroop_hpp */
